package com.itheima.reggie.common;

import com.itheima.reggie.entity.Employee;

//TODO:ThreadLocal的工具类BaseContext
public class BaseContext {
    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    /**
     * 设置当前登录用户的id
     * @param id
     */
    public static void setCurrentId(Long id){
        threadLocal.set(id);
    }

    /**
     * 获取当前登录用户的id
     * @return
     */
    public static Long getCurrentId(){
        return threadLocal.get();
    }

    /**
     * 删除当前登录用户的id
     */
    public static void removeCurrentId(){
        threadLocal.remove();
    }
}
